<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@ page import="com.bean.*" %>
 <%@ page import="com.DAO.*" %>
 <%@ page import="java.util.List" %>
 <%@ page import="java.util.ArrayList" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>首页</title>
<!-- 新 Bootstrap 核心 CSS 文件 -->
  <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

  <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
  <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>

  <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
  <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <style>
  	.showTies{
  		margin-top:20px;
  		margin-left:100px;
  		margin-right:100px;
  	}
  	.well{
  		display:flex;
  		justify-content:flex-end;
  		position:relative;
  		backgroud-color:rgba(0,0,0,0.2);
  	}
  	body{
  		margin:0;
  		padding:0;
  		background-image:url("./images/main1.jpg");
  		background-repeat:no-repeat;
  		background-size:cover;
  	}
  </style>
</head>
<body>
	<nav class="navbar navbar-default" role="navigation">
    <div class="container-fluid">
    <div class="navbar-header" style="margin-left:20px;">
        <a class="navbar-brand" href="#">欢迎欢迎,${sessionScope.SESSION_USER.getUsername() }</a>
    </div>
    <div style="margin-left:1200px">
        <ul class="nav navbar-nav">
            <li><a href="./personalInfo.jsp">个人中心</a></li>
            <li><a href="./publishTies.jsp">发布帖子</a></li>
            <li><a href="GetTies">我的贴子</a></li>
            <li><a href="#">在线人数:<%=this.getServletContext().getAttribute("onLineCount") %></a></li>
        </ul>
    </div>
    </div>
</nav>
	<div class="showTies">
		<%
		  TieDaoImpl tieinfo = new TieDaoImpl();
		try{
		  List<Tie> ties = tieinfo.findAllTie();
		  for(Tie tie:ties){
			  if(tie.getTieState().equals("通过")){
		%>
			<div class="well"><span style="margin-left:100px">标题:<a href='http://localhost:8080/publishTie/LookMyTie?id=<%=tie.getTieID() %>&t=l'><%=tie.getTieTitle() %></a></span> <span style="margin-left:100px;margin-right:200px;">作者:<%=tieinfo.findUserByTieID(tie.getTieID()).getUsername() %></span>
			<span style="float:right">发布时间:<%=tie.getTieDate() %></span>
			</div>
		<% } }
		}catch(Exception e){
			
		  %>
		  	<div>暂无数据</div>
		  <%} %>
	</div>
</body>
</html>